package com.neutech.neuski.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.neutech.neuski.service.SkiService;
import com.neutech.po.NeuSki;

 

@Controller
@RequestMapping(value = "/his")
public class SkiController {
	@Autowired
	private SkiService skiservice;
	@RequestMapping("/getNeuSkiById")
	public @ResponseBody NeuSki getNeuSki(Integer id) {
		NeuSki neuSki = skiservice.getNeuSki(id);
		return neuSki;
	}
 
	@RequestMapping(value = "/update", method = RequestMethod.GET)
	public  @ResponseBody String update(NeuSki neuSki) {
		int result = skiservice.getUpdate(neuSki);
		if (result >= 1) {
			return "修改成功";
		} else {
			return "修改失败";
		}
	}
	  
	@RequestMapping(value = "/insert", method = RequestMethod.GET)
	public  @ResponseBody NeuSki insert(NeuSki neuSki) {
		return skiservice.insertNeuSki(neuSki);
	}
	
	@RequestMapping(value = "/delete", method = RequestMethod.GET)
	public @ResponseBody String delete(int id) {
		int result = skiservice.delete(id);
		if (result >= 1) {
			return "删除成功";
		} else {
			return "删除失败";
		}
	}
}
